package ex.algorithms.datastructures;

import java.util.ArrayList;
import java.util.List;


public class Stack {
	private Integer top = 0;
	private int[] items;
	private int length;
	
	public Stack(int length) {
		items = new int[length];
		this.length = length;
	}
	
	public void push(Integer i) {
		top ++;
		if(top > length) {
			top --;
			System.out.println("Stack full");
			return;
		}
		
		items[top - 1] = i;
	}
	
	public Integer pop() {
		if(top == 0)
			return null;
		
		top --;
		return items[top];
	}
}
